/**
 * <p>Title: DataInterface.java</p>
 * <p>Description: </p>
 * <p>Copyright: Baosight Software LTD.co Copyright (c) 2002</p>
 * <p>Company: Baosight Software</p>
 * @author 张志芳
 * @version 1.0
 * <pre>Histroy:
 *          2011-2-11 上午10:03:42  张志芳  Create
 *</pre>
 */
package com.baosight.sczx.common.zm.cInterface.cs;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiColumn;
import com.baosight.iplat4j.core.spring.SpringApplicationContext;
import com.baosight.iplat4j.dao.Dao;

/**
 * <p>Title: DataInterface.java</p>
 * <p>Description: </p>
 * <p>Copyright: Baosight Software LTD.co Copyright (c) 2002</p>
 * <p>Company: Baosight Software</p>
 * @author 张志芳
 * @version 1.0
 * <pre>Histroy:
 *          2011-2-11 上午10:03:42  张志芳  Create
 *</pre>
 */
public class DataInterface {

	private static Dao dao = (Dao)SpringApplicationContext.getBean("dao");
	
	/**
	 * 获取所有数据接口
	 * <p>Function: getDataInterface</p>
	 * <p>Description: </p>
	 * <p>return value:List<Map></p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-2-11上午10:06:39 张志芳
	 * </p>
	 *
	 */
	@SuppressWarnings({ "rawtypes", "unchecked" })
	public static List<Map> getDataInterface(){
		List<Map>  _list = new ArrayList();
		try {
			_list = dao.query("ZMCSDataInterface.queryInterface", null);
		} catch (Exception e) {

		}
		return _list;
	}
	
	/**
	 * 获取所有数据接口的block
	 * <p>Function: getMineBlock</p>
	 * <p>Description: </p>
	 * <p>return value:EiBlock</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2011-2-11上午10:06:54 张志芳
	 * </p>
	 *
	 */
	@SuppressWarnings("rawtypes")
	public static EiBlock getDataInterfaceBlock(String blockNo){                                                              
		EiBlock block = new EiBlock(blockNo);
		
		EiColumn eiColumn = new EiColumn("value");
		eiColumn.setType("C");
		block.addMeta(eiColumn);
		
		eiColumn = new EiColumn("display");
		eiColumn.setType("C");
		block.addMeta(eiColumn);
		
		eiColumn = new EiColumn("type");
		eiColumn.setType("C");
		block.addMeta(eiColumn);
		
		List<Map> list = new ArrayList<Map>();
		list = getDataInterface();
		block.setRows(list);
		return block;
	}
}
